﻿/*
 * Created by SharpDevelop.
 * User: ratul
 * Date: 3/3/2010
 * Time: 1:55 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using H264Impl.NET.Sample;

namespace H264Impl.NET
{
	/// <summary>
	/// Description of Block.
	/// </summary>
	public class Block
	{
		public Block()
		{
		}
				
		UInt32 blockWidth;
		UInt32 blockHeight;
		
		public Block(SampleArrayFactory.SamplingType samplingType, UInt32 blockWidth, UInt32 blockHeight, bool separateColorPlane)
		{
			this.blockWidth = blockWidth;
			this.blockHeight = blockHeight;
			
			sampleArray = Sample.SampleArrayFactory.createSampleArray(samplingType, blockWidth, blockHeight, separateColorPlane);
			
		}
		
		protected Sample.SampleArray sampleArray;
		protected UInt32 blockAddress;
		
		public SpatialLocation inverseBlockScan(UInt32 pictureWidthinSamples)
		{
			SpatialLocation loc = new SpatialLocation();
			loc.x = Utility.InverseRasterScan(blockAddress, blockWidth, blockHeight, pictureWidthinSamples, false);
			loc.y = Utility.InverseRasterScan(blockAddress, blockWidth, blockHeight, pictureWidthinSamples, true);
			return loc;
		
		}
	}
}
